package com.study.utils;

import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zhuzi
 * 2024/11/19 16:38
 */
public class HtoolDemo {


    @Test
    public void sub() {

        String str = "\u0002+00164031B\u0003\u0002+00164031B\u0003\u0002+00164031B\u0003\u0002+";
        //str = "\u0002+00172031C\u0003\u0002+00172031C\u0003\u0002+00172031C\u0003\u0002+";

        List<String> split = StrUtil.split(str, "+");
        for (String s : split) {

            String trim = s.trim();
            //System.out.println(StrUtil.sub(trim, -3, 0));
        }
        List<String> collect = StrUtil.split(str, "+").stream().map(s -> s.trim())
                .filter(str1 -> StringUtils.length(str1.trim()) >= 9)
                .map(str1 -> StrUtil.sub(str1, -3, 0)).collect(Collectors.toList());

        String parseIntStr = collect.size() >= 2 ? collect.get(1) : "";
        System.out.println(Long.parseLong(parseIntStr));


    }

    @Test
    public void sub1() {
        String str = "https://jiucaigongshe.oss-cn-beijing.aliyuncs.com/import/858929F6-1E53-4230-9AA0-5498DD7776E2.jpg?x-oss-process=image/auto-orient, 1/watermark, type_ZmFuZ3poZW5naGVpdGk, size_42, text_6Z-t56CU5YWs56S-77yaQOe9kee7nOeUqOaItw, color_FFFFFF, shadow_50, t_100, g_se, x_16, y_16";
        String s = StrUtil.subBefore(str, '?', false);
        System.out.println(s);
    }
}
